#include "fx_echo.h"
#include "ui_fx_echo.h"

fx_echo::fx_echo(QWidget *parent) :
    fx_basic(parent),
    ui(new Ui::fx_echo)
{
    ui->setupUi(this);
    ui->label_wet->setText(QString::number(50));
    ui->label_feed->setText(QString::number(50));
    ui->label_left->setText(QString::number(500));
    ui->label_right->setText(QString::number(500));

    QStringList wave_form;
    wave_form << "No" << "Yes";
    ui->comboBox->addItems(wave_form);
    ui->comboBox->setCurrentIndex(0);

}

fx_echo::~fx_echo()
{
    delete ui;
}

void fx_echo::feed(int value)
{
    ui->label_feed->setText(QString::number(value));
}

void fx_echo::wet(int value)
{
    ui->label_wet->setText(QString::number(value));
}
void fx_echo::left(int value)
{
    ui->label_left->setText(QString::number(value) + " ms");
}
void fx_echo::right(int value)
{
    ui->label_right->setText(QString::number(value) + " ms");
}

void fx_echo::addFX()
{
    BASS_DX8_ECHO* result = new BASS_DX8_ECHO();
    result->fWetDryMix = ui->horizontalSlider_wet->value();
    result->fFeedback = ui->horizontalSlider_feed->value();
    result->fLeftDelay = ui->horizontalSlider_left->value();
    result->fRightDelay = ui->horizontalSlider_right->value();
    if (ui->comboBox->currentIndex() == 1)
        result->lPanDelay = TRUE;
    else
        result->lPanDelay = FALSE;
    emit apply(BASS_FX_DX8_ECHO, result);
}
